package com.seaboxdata.interfaceJob;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Component
@Configuration
@Slf4j
public class EmergencyResourceJob {
    /*@Autowired
    private EmergencyResourceService emergencyResourceService;
    @Autowired
    private EmergencyResourceSynchronizer emergencyResourceSynchronizer;

    @Scheduled(cron = "${crontab.emergencyResouce}")//每隔5分钟执行一次
    public void doCollect(){
        List<EmergencyResource> list= emergencyResourceSynchronizer.queryEmergencyResource();
        if (!CollectionUtils.isEmpty(list)){
            List<String> ids = list.stream().map(EmergencyResource::getId).collect(Collectors.toList());
            List<String> existedIds=emergencyResourceService.selectExistedIds(ids);
            if (CollectionUtils.isNotEmpty(existedIds)){
                list = list.stream().filter(w -> !existedIds.contains(w.getId())).collect(Collectors.toList());
            }
            if (CollectionUtils.isNotEmpty(list)) {
                log.info("------------insert alarm size={}"+list.size());
                emergencyResourceService.saveBatch(list);
            }
        }
        log.info("emergencyResouce insert success");
    }*/
}
